import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '用户',
    align: "center",
    dataIndex: 'userId'
  },
  {
    title: '开始时间',
    align: "center",
    dataIndex: 'startDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '结束时间',
    align: "center",
    dataIndex: 'endDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text);
    },
  },
  {
    title: '月收入',
    align: "center",
    dataIndex: 'monthlyEarning'
  },
  {
    title: '总收入',
    align: "center",
    dataIndex: 'earning'
  },
  {
    title: '地址',
    align: "center",
    dataIndex: 'place'
  },
  {
    title: '类型',
    align: "center",
    dataIndex: 'jtype_dictText'
  },
  {
    title: '说明',
    align: "center",
    dataIndex: 'comment'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "地址",
    field: 'place',
    component: 'Input',
    colProps: {span: 6},
  },
  {
    label: "类型",
    field: 'jtype',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "xj_job"
    },
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '用户',
    field: 'userId',
    component: 'Input',
  },
  {
    label: '开始时间',
    field: 'startDate',
    component: 'DatePicker',
  },
  {
    label: '结束时间',
    field: 'endDate',
    component: 'DatePicker',
  },
  {
    label: '月收入',
    field: 'monthlyEarning',
    component: 'InputNumber',
  },
  {
    label: '总收入',
    field: 'earning',
    component: 'InputNumber',
  },
  {
    label: '地址',
    field: 'place',
    component: 'Input',
  },
  {
    label: '类型',
    field: 'jtype',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "xj_job"
    },
  },
  {
    label: '说明',
    field: 'comment',
    component: 'InputTextArea',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
